from rest_framework.response import Response
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from apps.meiduo_admin.utils import PageNum
from apps.goods.models import SPUSpecification
from apps.meiduo_admin.serializers.specs import *


class SpecsViewSet(ModelViewSet):
    """规格管理"""
    serializer_class = SpecsModelSerializer
    queryset = SPUSpecification.objects.all()
    pagination_class = PageNum

class OptionsViewSet(ModelViewSet):
    """规格选项管理"""
    serializer_class = OptionsSerializer
    queryset = SpecificationOption.objects.all()
    pagination_class = PageNum


class SimpleView(ListAPIView):
    """保存规格"""
    serializer_class = SpecsModelSerializer
    queryset = SPUSpecification.objects.all()
